package bean;

import java.util.HashMap;
import java.util.Map;

public class Score {
    private int score;
    public static final int GOOD = 4;
    public static final int NICE = 3;
    public static final int NORMAL = 2;
    public static final int BAD = 1;
    public static final int SAD = 0;
    public Score(int score) {
        this.score = score;
    }

    public int getStar()
    {
        if (score >= 80)
        {
            return 4;
        }else if (score < 80 && score >= 60)
        {
            return 3;
        }else if (score <60 && score >= 40)
        {
            return 2;
        }else if (score <40 && score >= 20)
        {
            return 1;
        }else
        {
            return 0;
        }
    }
    private static Map<Integer,String> starMap = new HashMap<Integer, String>()
    {
        {
              put(4,"Good");
              put(3,"Nice");
              put(2,"Normal");
              put(1,"Bad");
              put(0,"Sad");
        }
    };
    public static String parse(int i)
    {
        return starMap.get(i);
    }
}
